<?php

use Phinx\Migration\AbstractMigration;

class CreateChatGlobalIdUserIdIndexInChatUserTable extends AbstractMigration
{
    public function up()
    {
        $this->table("chat_user")
            ->addIndex(['user_id', 'chat_global_id'], ['type' => 'unique', 'name' => 'idx_unique_user_id_and_chat_global_id'])
            ->save();
    }

    public function down()
    {
        $this->table("chat_user")
            ->removeIndexByName("idx_unique_user_id_and_chat_global_id")->save();
    }
}
